import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent as MemberHomeCmp} from './member/home/home.component';
import { LoginComponent } from './member/login/login.component';
import { LogoutComponent } from './member/logout/logout.component';
import { RegisteComponent } from './member/registe/registe.component';
import { RegisterLicensesComponent } from './member/register-licenses/register-licenses.component';
import { LostPasswordComponent } from './member/lost-password/lost-password.component';
import { ListComponent as BoardListCmp} from './board/list/list.component';
import { DetailComponent as BoardHomeCmp} from './board/detail/detail.component';
import { IndexComponent as TopicHomeCmp} from './topic/index/index.component';
import { MainComponent } from './home/main/main.component';
import { BoardGroupDetailComponent } from './board/board-group-detail/board-group-detail.component';
import { PersonalComponent as MemberPersonalCmp } from './member/personal/personal.component';
import { MemberAuthorizeGuard } from './guards/member-authorize.guard';
import { PublishThreadsComponent } from './topic/publish-threads/publish-threads.component';
import { PageNotFoundComponent } from './home/page-not-found/page-not-found.component';
import { ThreadsPosterComponent } from './topic/threads-poster/threads-poster.component';
import { RestPasswordComponent } from './member/rest-password/rest-password.component';
import { RestPasswordSuccessComponent } from './member/rest-password-success/rest-password-success.component';
import { PersonalAvatarComponent } from './member/personal-avatar/personal-avatar.component';
import { PersonalProfileComponent } from './member/personal-profile/personal-profile.component';
import { PersonalPassportComponent } from './member/personal-passport/personal-passport.component';
import { PersonalHistoryComponent } from './member/personal-history/personal-history.component';
import { PersonalPassportSuccessComponent } from './member/personal-passport-success/personal-passport-success.component';
import { PersonalSocialComponent } from './member/personal-social/personal-social.component';
import { PersonalPublishTopicResultComponent } from './member/personal-publish-topic-result/personal-publish-topic-result.component';
import { PersonalReplyTopicResultComponent } from './member/personal-reply-topic-result/personal-reply-topic-result.component';
import { PersonalLikeTopicResultComponent } from './member/personal-like-topic-result/personal-like-topic-result.component';
import { PersonalFavoriteTopicResultComponent } from './member/personal-favorite-topic-result/personal-favorite-topic-result.component';
import { PersonalFavoriteBoardResultComponent } from './member/personal-favorite-board-result/personal-favorite-board-result.component';
import { InboxPageComponent } from './message/inbox-page/inbox-page.component';
import { InboxChatPageComponent } from './message/inbox-chat-page/inbox-chat-page.component';

const routes: Routes = [
  {path:'', redirectTo:'/home', pathMatch:'full'},
  {path:'member/login', component:LoginComponent},
  {path:'member/register', component:RegisteComponent},
  {path:'member/offline', component:LogoutComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/lostPswd', component:LostPasswordComponent},
  {path:'member/rsetPswd', component:RestPasswordComponent},
  {path:'member/rsetPswd/success', component:RestPasswordSuccessComponent},
  {path:'member/register/licenses', component:RegisterLicensesComponent},
  {path:'member/home', component:MemberPersonalCmp, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/profile', component:PersonalProfileComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/avatar', component:PersonalAvatarComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/passport', component:PersonalPassportComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/passport/success', component:PersonalPassportSuccessComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/history', component:PersonalHistoryComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/board', component:PersonalFavoriteBoardResultComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/social', component:PersonalSocialComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/topic', component:PersonalPublishTopicResultComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/posts', component:PersonalReplyTopicResultComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/topic/favorite', component:PersonalFavoriteTopicResultComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/home/topic/like', component:PersonalLikeTopicResultComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'member/:uid', component:MemberHomeCmp},
  {path:'message', component:InboxPageComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'message/chat/:sender', component:InboxChatPageComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'topic/create', component:PublishThreadsComponent, canActivate:[MemberAuthorizeGuard]},
  {path:'topic/poster', component:ThreadsPosterComponent},
  {path:'topic/:constr', component:TopicHomeCmp},
  {path:'board/home', component:BoardListCmp},
  {path:'board/volumes/:constr', component:BoardGroupDetailComponent},
  {path:'board/:constr', component:BoardHomeCmp},
  {path:'home', component:MainComponent},
  {path:'404', component:PageNotFoundComponent},
  {path:'**', redirectTo:'404'}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
